package com.example.program.Dao;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.example.program.Helper.MyHelper;
import com.example.program.bean.LogBean;
import com.example.program.bean.PassBean;

import java.util.ArrayList;

public class PassDao {
    private MyHelper myHelper;
    private Context mCon = null;

    public PassDao(Context context) {
        mCon = context;
        myHelper = new MyHelper(mCon);
    }

    public LogBean getLoginAc() {
        SQLiteDatabase readableDatabase = myHelper.getReadableDatabase();
        Cursor cursor = readableDatabase.rawQuery("SELECT * FROM Login_DB", null);
        cursor.moveToFirst();
        String Account = cursor.getString(0);
        String Password = cursor.getString(1);
        LogBean logBean = new LogBean();
        logBean.LOG_acc = Account;
        logBean.LOG_pas = Password;
        cursor.close();
        return logBean;
    }

    public ArrayList<PassBean> getPassAc() {
        SQLiteDatabase readableDatabase = myHelper.getWritableDatabase();
        Cursor cursor = readableDatabase.rawQuery("SELECT * FROM PassW_DB", null);
        if (cursor.getCount() == 0) {
            return null;
        } else {

            return null;
        }

    }
}
